﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace NetCoreQrCoreDemo.Controllers
{
    //后台API
    [Route("api/[controller]")]
    [ApiController]
    public class TestApiController : ControllerBase
    {
        
        //扫码成功 调用
        [HttpGet]
        public IActionResult Get(string cid)
        {
            Startup.GlobalHub.InvokeByIDAsync(cid, "ScanSuccess", "/imgs/jry.jpg");
            return new JsonResult(new { Code = 200, Message = "扫码成功" });
        }

        //确认登录调用
        [HttpPost]
        public IActionResult Post(string cid,string user,string pwd,string username)
        {
            Startup.GlobalHub.InvokeByIDAsync(cid, "LoginSuccess", new { user = user, pwd = pwd,username=username });
            return new JsonResult(new{Code=200,Message="登录成功"});
        }
    }
}